<template>
	<div class="seckill-details-index">
		<seckill-pic></seckill-pic>	
		<seckill-details-basic-info></seckill-details-basic-info>
		<pro-count></pro-count>
		<details-commodity-info></details-commodity-info>
		<count-down class="count-down"></count-down>
	</div>
</template>

<script>

	import seckillPic from './seckill-pic';
	import detailsCommodityInfo from '../details/details-commodity-info';
	import detailsBuyBtn from '../common/details-buy-btn';
	import countDown from './count-down';
	import seckillDetailsBasicInfo from './seckill-details-basic-info';
	import proCount from './pro-count';
	import Vue from 'vue';
	import VueResource from 'vue-resource';
	import common from '../../utils/common';

	console.log(common.isdev());
	Vue.use(VueResource);
	Vue.http.options.emulateJSON = true;


	export default {
		
		data:function(){
			return{
					time:[],
					imgurl:''
			}
		},
		components: {
			seckillPic, detailsCommodityInfo, detailsBuyBtn, countDown, seckillDetailsBasicInfo, proCount
		},
		ready:function(){
			var _this=this;

			this.$http.get(common.isdev()+'/prmtcenter/seckill/333.json',{

			}).then(function(d){
				//console.log(d.data.data); 2016-10-30 05:15:42
				var nowTime=d.data.data.nowTime; 
				var startTime=JSON.parse(d.data.data.seckillInfo).activityStarttime;
				var endTime=JSON.parse(d.data.data.seckillInfo).activityEndtime;

				_this.imgurl=JSON.parse(d.data.data.seckillInfo).mainImage;//.mainImgUrl
				// var startTime="2016-10-28 05:15:32"
				// var nowTime="2016-10-29 05:15:22"
				// var endTime="2016-10-30 05:15:42"
				
				_this.time.push(startTime,nowTime,endTime);
				
				// 向子级传值
				_this.$broadcast('sendTime', _this.time);
				_this.$broadcast('sendImg', _this.imgurl);


				

			},function(){
				console.log(error);
			});

			this.$http.post(common.isdev()+'/prmtcenter/seckill/execute.json',{
				"activityId":"353"
			}).then(function(d){
				console.log(d.data);
			}, function(){
				console.log(error);
			});
		}
	}



</script>

<style lang="scss">

	@import '../../assets/css/_functions.scss';
	@import '../../assets/css/_variables.scss';
	
</style>
